package edu.cuit.zhuyimeng.framework.common.config;

import edu.cuit.zhuyimeng.framework.common.handler.GlobalExceptionHandler;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.ConditionalOnReactiveDiscoveryEnabled;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;

/**
 * 全局处理器自动配置类
 */
@AutoConfiguration
@ComponentScan(basePackages={"cn.hutool.extra.spring"})
@Import(cn.hutool.extra.spring.SpringUtil.class)
public class GlobalHandlerAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnMissingClass("edu.cuit.zhuyimeng.gateway.GatewayApplication")
    public GlobalExceptionHandler commonGlobalExceptionHandler() {
        return new GlobalExceptionHandler();
    }

}
